


local func1 = {}
local tips = {}


func1['迷宫地图'] = function(count,hero,player)
    local name = random_item_name(math.random(1,3))
    local item = collate_item(hero,name)
end

func1['兑换折扣'] = function(count,hero,player)
    local count = 3
    hero:event '单位-购买神秘商店物品'(function(trg,unit,skill)
        local xd = math.floor(skill:get_food() * 0.5)
        player:add('杀敌',xd)
        player:send_msg(('[兑换折扣]返还%s杀敌'):format(xd))
        count = count - 1
        if count<=0 then
            trg:remove()
        end
    end)
end


func1['打铁工具'] = function(count,hero,player)
    
    for a=1,3  do
        local name = random_item_name(math.random(1,2))
        local item = collate_item(hero,name)
    end
end

func1['锻造之锤'] = function(count,hero,player)
    ac.wait(3*60*1000,function()
        local name = random_item_name(3)
        local item = collate_item(hero,name)
    end)
end


func1['英雄卡牌2'] = function(count,hero,player)
    hero:add('英雄刷新次数',2)
end

local list_up = {
    {'朱雀气息','升级智力',{10,20,30}},
    {'玄武气息','升级力量',{10,20,30}},
    {'青龙气息','升级敏捷',{10,20,30}},
    {'白虎气息','升级攻击',{10,20,30}},
    {'朱雀之魂','基础智力',{500,750,1000}},
    {'玄武之魂','基础力量',{500,750,1000}},
    {'青龙之魂','基础敏捷',{500,750,1000}},
    {'白虎之魂','基础攻击',{500,750,1000}},
}

for _,da in ipairs(list_up) do
    local name = da[1]
    local key = da[2]
    local vals = da[3]
    func1[name] = function(count,hero,player,temp)
        local val = vals[count] or vals[#vals]
        hero:add(key,val)
        
    end
    tips[name] = function(self)
        local player = ac.player.self
        local num = table.copy(vals)
        local has = player:get_data('天赋拥有表') or {}
        local count = has[self.name] or 0
        if count<3 then
            num[count+1] = ('|cff00ff00%s|r'):format(num[count+1])
        end
        local tip = ('%s+%s'):format(key,table.concat(num,'/'))
        return tip
    end
end

func1['矮人王'] = function(count,hero,player)
    collate_item(hero,'六级吞噬丹')
end

func1['铁匠之心'] = function(count,hero,player)
    local name = random_item_name(math.random(2,4))
    local item = collate_item(hero,name)
    hero:add('装备加成',10)
end

func1['时间回溯'] = function(count,hero,player)
    hero:set_level(math.max(hero.level-10,1))
end

func1['四阶兵器'] = function(count,hero,player)
    local name = random_item_name(math.random(3,5))
    local item = collate_item(hero,name)
end

func1['神秘·奇遇'] = function(count,hero,player)
    player:notify('英雄-刷新随机事件',player)
end

func1['神秘·转生之源'] = function(count,hero,player)
    collate_item(hero,'转生之源')
end

func1['神秘·觉醒石'] = function(count,hero,player)
    hero:create_jx_item()
end

func1['神秘·奇遇加速'] = function(count,hero,player)
    player:set_data('奇遇效率',player:get_data('奇遇效率',0) + 10)
end

func1['神秘·黑市'] = function(count,hero,player)
    player:set_data('黑市额外物品',player:get_data('黑市额外物品',0) + 1)
end

func1['神秘·魂晶'] = function(count,hero,player)
    hero:add_buff '神秘·魂晶'{
        art = [[羁绊卡牌\KP_sm_7.blp]],
        tip = [[剩余杀敌:|cffff0000'count'|r|n|n奖励：|n伤害增幅+20%]],
        keep = 1,
        count = 2000,
        on_add = function(self)
            self:gc(hero:event '英雄-击杀单位'(function(trg)
                self.count = self.count - 1
                if self.count==0 then
                    trg:remove()
                    hero:add('伤害增幅',20)
                    player:send_msg('[神秘·魂晶]伤害增幅+20%')
                    self:remove()
                end
            end))
        end
    }
end

func1['神秘·重铸石'] = function(count,hero,player)
    local item = ac.item.create('重铸宝石',ac.point(0,0),{count = 2})
    collate_item(hero,item)
end

func1['神秘·力量'] = function(count,hero,player)
    hero:add('基础力量',hero:get('基础力量')*0.1)
end
func1['神秘·敏捷'] = function(count,hero,player)
    hero:add('基础敏捷',hero:get('基础敏捷')*0.1)
end
func1['神秘·智力'] = function(count,hero,player)
    hero:add('基础智力',hero:get('基础智力')*0.1)
end

func1['矮人王'] = function(count,hero,player)
    collate_item(hero,'六级吞噬丹')
end

func1['等级之书'] = function(count,hero,player)
    hero:add_level(3)
end

func1['英雄卡牌'] = function(count,hero,player)
    hero:add('英雄刷新次数',1)
end

func1['红莲技'] = function(count,hero,player)
    hero:add_skill('红莲斩')
end

func1['邪恶圣杯'] = function(count,hero,player)
    local skill = hero:find_skill('咖喱棒')
    if skill then
        skill:remove()
    end
    hero:add_skill('EX咖喱棒')
end

func1['探索怪'] = function(count,hero,player)
    hero:create_jx_item()
    hero:create_jx_item()
end

return {
    func = func1,
    tips = tips,
}